/*     */ package nccloud.web.codeplatform.framework.action.base;
/*     */ 
/*     */ import java.io.ByteArrayOutputStream;
/*     */ import java.io.PrintStream;
/*     */ import java.util.Arrays;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import java.util.logging.Logger;
/*     */ import nc.bs.framework.json.core.exception.ExceptionUtils;
/*     */ import nc.bs.uif2.validation.ValidationException;
/*     */ import nc.vo.pub.BusinessException;
/*     */ import nc.vo.pub.lang.UFDateTime;
/*     */ import nccloud.framework.web.action.itf.ICommonAction;
/*     */ import nccloud.framework.web.container.IRequest;
/*     */ import nccloud.web.action.DataPermissionAction;
/*     */ import nccloud.web.codeplatform.framework.commons.tree.ITreeBuilder;
/*     */ import nccloud.web.codeplatform.framework.commons.tree.ITreeWapper;
/*     */ import nccloud.web.codeplatform.framework.commons.tree.PidTreeBuilder;
/*     */ import nccloud.web.codeplatform.framework.commons.tree.TreeWapper;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public abstract class BaseAction
/*     */   implements ICommonAction
/*     */ {
/*  29 */   static final Logger LOG = Logger.getLogger(BaseAction.class.getName());
/*     */ 
/*     */   
/*     */   public Object doAction(IRequest request) {
/*  33 */     RequstParamWapper paramWapper = new RequstParamWapper(request);
/*     */     try {
/*  35 */       return doAction(request, paramWapper);
/*  36 */     } catch (Throwable e) {
/*  37 */       handerException(e);
/*     */       
/*  39 */       return null;
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   protected void handerException(Throwable e) {
/*  50 */     printException(e);
/*  51 */     ExceptionUtils.wrapException(e);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void printException(Throwable e) {
/*  60 */     ByteArrayOutputStream out = new ByteArrayOutputStream();
/*  61 */     e.printStackTrace(new PrintStream(out));
/*  62 */     LOG.warning(out.toString());
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public Map<String, Long> createPKTSMap(String[] pks) {
/*  73 */     Map<String, Long> tsMap = new HashMap<String, Long>();
/*  74 */     Arrays.stream(pks).forEach(pkAndTs -> {
/*  75 */           String[] pkts = pkAndTs.split("_");
/*  76 */           UFDateTime aaa = new UFDateTime(pkts[1]);
/*  77 */           tsMap.put(pkts[0], Long.valueOf(aaa.getMillis()));
/*     */         });
/*  79 */     return tsMap;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   protected void checkDataPermission(String resourcecode, String mdoperatorcode, String operatorcode, Object[] objvos) throws BusinessException {
/*  94 */     DataPermissionAction dataPermissionAction = new DataPermissionAction();
/*  95 */     ValidationException validException = dataPermissionAction.checkDataPermission(resourcecode, mdoperatorcode, operatorcode, objvos);
/*     */     
/*  97 */     dataPermissionAction.dealValidationException(validException);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   protected Object buildResult(RequestDTO param, boolean isCard, Map<String, Object> externalData, Object... vos) {
/* 111 */     String pagecode = param.getPageCode();
/* 112 */     String formid = param.getFormId();
/* 113 */     String[] tableid = param.getTableId();
/* 114 */     String tailid = param.getTailId();
/* 115 */     String[] allpks = param.getAllpks();
/*     */     
/* 117 */     VOTransform voTransfer = new VOTransform(null, pagecode);
/*     */     
/* 119 */     ResultWapper res = voTransfer.vo2Front(isCard, pagecode, formid, tableid, tailid, allpks, param.getPageInfo(), vos);
/*     */     
/* 121 */     if (externalData != null && externalData.size() > 0) {
/* 122 */       res.setExternalData(externalData);
/*     */     }
/* 124 */     return res;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   protected Object buildResult(ITreeBuilder treeBuilder, Object... objs) throws BusinessException {
/* 137 */     if (treeBuilder == null) {
/* 138 */       treeBuilder = new PidTreeBuilder();
/*     */     }
/* 140 */     ITreeWapper treewapper = new TreeWapper(objs, treeBuilder);
/* 141 */     return treewapper.getTree();
/*     */   }
/*     */   
/*     */   public abstract Object doAction(IRequest paramIRequest, RequstParamWapper paramRequstParamWapper) throws Throwable;
/*     */ }


/* Location:              E:\zhuhai_ncc\NCC2111\external\li\\uilcdp_nccloud_cdeLevel-1.jar!/nccloud/web/codeplatform/framework/action/base/BaseAction.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */